package com.zhan.ielts.web.controller;


import java.util.HashMap;
import java.util.Map;

import com.zhan.frame.core.utils.EnvPropertiesUtil;
import com.zhan.ielts.utils.JsonUtils;
import com.zhan.ielts.utils.NetUtils;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zhan.frame.core.web.domain.CustomResult;
import com.zhan.frame.core.web.domain.Result;
import com.zhan.frame.core.web.domain.Result.Status;
import com.zhan.ielts.domain.Param;
import com.zhan.ielts.service.ParamService;

@Controller
@RequestMapping("/app")
public class BundleController {

	private Logger log = LoggerFactory.getLogger(BundleController.class);

	@Autowired
	private ParamService paramService;

	@SuppressWarnings({ "rawtypes", "unchecked" })
	@ResponseBody
	@RequestMapping(value = "/review", method = RequestMethod.POST)
	public CustomResult fetch(String bundleIdentifier, String version) {
		//调用commonsystem审核开关接口
		Map<String, Object> paramMap = new HashMap<>();
		paramMap.put("bundleIdentifier", bundleIdentifier);
		paramMap.put("version", version);
		String url = EnvPropertiesUtil.getProperties("commonSystemUrl") + "/appRelease/review";
		String result = NetUtils.doPost(url, JSONObject.fromObject(paramMap).toString(), true);
		CustomResult jsonResult = JsonUtils.fromJson(result, CustomResult.class);
		return jsonResult;
	}
}
